package com.sgb.kjwl.repository.impl;


import com.sgb.kjwl.R;
import com.sgb.kjwl.model.api.ApiSource;
import com.sgb.kjwl.model.api.PreferenceSource;
import com.sgb.kjwl.model.entity.BidDetailEntity;
import com.sgb.kjwl.model.entity.BidInvitationListEntity;
import com.sgb.jicai.entity.FilterEntity;
import com.sgb.kjwl.model.entity.LoginEntity;
import com.swgk.core.BaseAppHelper;
import com.swgk.core.view.entity.MenuEntity;
import com.sgb.link.entity.PublicTypeEntity;
import com.sgb.kjwl.model.entity.SelfEntity;
import com.sgb.kjwl.model.entity.UserMsgEntity;
import com.sgb.kjwl.model.entity.self.GoodsListEntity3;
import com.sgb.kjwl.model.entity.self.SelfPickListEntity3;
import com.sgb.kjwl.model.entity.supplier3.DictEntity3;
import com.sgb.kjwl.model.entity.user.AddDeviceEntity;
import com.sgb.kjwl.model.entity.user.AddGoodsEntity;
import com.sgb.kjwl.model.entity.user.AddMachineInEntity;
import com.sgb.kjwl.model.entity.user.AddMachineOutEntity;
import com.sgb.kjwl.model.entity.user.AddPackersEntity;
import com.sgb.kjwl.model.entity.user.AddTalentEntity;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.sgb.kjwl.model.entity.user.AuthEntity;
import com.sgb.kjwl.model.entity.user.CategoryEntity;
import com.sgb.kjwl.model.entity.user.DeviceStateEntity;
import com.sgb.kjwl.model.entity.user.DictEntity;
import com.sgb.kjwl.model.entity.user.GoodsEntity;
import com.sgb.kjwl.model.entity.user.MachineStateEntity;
import com.sgb.kjwl.model.entity.user.MachineryCompanyEntity;
import com.sgb.kjwl.model.entity.user.NewCategeryEntity;
import com.sgb.kjwl.model.entity.user.PackersStateEntity;
import com.sgb.kjwl.model.entity.user.PhotoEntity;
import com.sgb.kjwl.model.entity.user.SupplierAuthEntity;
import com.sgb.kjwl.model.entity.user.TalentTypeEntity;
import com.sgb.kjwl.model.entity.user.UnitEntity;
import com.sgb.kjwl.model.entity.user.UserAddressEntity;
import com.swgk.core.base.model.entity.ListResponse;
import com.sgb.kjwl.repository.SelfRepertory;
import com.swgk.core.base.api.BaseApiSource;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.base.model.preference.BasePreferenceSource;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class SelfRepertoryImpl extends BaseRepertoryImpl implements SelfRepertory {
    private ApiSource apiSource;
    private PreferenceSource preferenceSource;

    public SelfRepertoryImpl(BaseApiSource apiSource, BasePreferenceSource preferenceSource) {
        super(apiSource, preferenceSource);
        this.apiSource = (ApiSource) apiSource;
        this.preferenceSource = (PreferenceSource) preferenceSource;
    }

    @Override
    public Observable<List<SelfEntity>> createPublishData(int role) {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getPublishData(role));
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createSelfOderData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getSelfOderData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createPickData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getPickData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> register(String account, String pwd, String code) {
        return apiSource.register(account, pwd, code).compose(this.<BaseEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> getRegisterCode(String phone) {
        return apiSource.getRegisterCode(phone).compose(this.<BaseEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> getForgetCode(String phone) {
        return apiSource.getForgetCode(phone).compose(this.<BaseEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> forgetPwd(String account, String pwd, String code) {
        return apiSource.forgetPwd(account, pwd, code).compose(this.<BaseEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<LoginEntity> login(String account, String pwd, String code) {
        return apiSource.login(account, pwd, code).compose(this.<LoginEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> loginOut(String accesstoken) {
        return apiSource.loginOut(accesstoken).compose(this.<BaseEntity>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<UserMsgEntity>> getCurrentUserInfo() {
        return apiSource.getCurrentUserInfo().compose(this.<BaseEntity<UserMsgEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<SupplierAuthEntity>> getSupplierAuthInfo() {
        return apiSource.getSupplierAuthInfo().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addSupplierAuth(SupplierAuthEntity supplierAuthEntity) {
        return apiSource.addSupplierAuth(supplierAuthEntity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<PhotoEntity>> uploadPhoto(File file) {
        Map<String, RequestBody> photos = new HashMap<>();
        RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        photos.put("file" + "\"; filename=\"" + "image.jpg\"", requestBody);
        return apiSource.uploadPhoto(photos).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> uploadFile(File file) {
        Map<String, RequestBody> photos = new HashMap<>();
        RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        photos.put("file" + "\"; filename=\"" + "image.jpg\"", requestBody);
        return apiSource.uploadFile(photos).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<String>>> uploadMutiFile(List<File> fileList) {
        Map<String, RequestBody> photos = new HashMap<>();
        int i = 0;
        for (File file : fileList) {
            RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
            photos.put("file" + "\"; filename=\"" + i + "image.jpg\"", requestBody);
            i++;
        }
        return apiSource.uploadMutiFile(photos).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<List<String>> getCompanyType() {
        return apiSource.getCompanyType().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<DictEntity>>> getBusiness() {
        return apiSource.getBusiness().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> getAddress() {
        return apiSource.getAddress().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<PackersStateEntity>>>> getPublishPackers(String state, int page, int size) {
        return apiSource.getPublishPackers(state, page, size).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<MenuEntity<MenuEntity<MenuEntity>>>>> getCategoryMenu() {
        return apiSource.getCategoryMenu(preferenceSource.getAreaCode()).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<NewCategeryEntity<List<NewCategeryEntity<List<NewCategeryEntity>>>>>>> getNewCategoryMenu() {
        return apiSource.getNewCategoryMenu().compose(rxSchedulerHelper());
    }

    public Observable<BaseEntity> onPacker(String id) {
        return apiSource.onPacker(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> offPacker(String id) {
        return apiSource.offPacker(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> delPackersList(String id) {
        return apiSource.delPackersList(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<CategoryEntity<CategoryEntity>>>> getPackersCategory() {
        return apiSource.getPackersCategory().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addPackers(AddPackersEntity entity) {
        return apiSource.addPackers(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> editPackers(AddPackersEntity entity) {
        return apiSource.editPackers(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AddPackersEntity>> getPackersDetail(String id) {
        return apiSource.getPackersDetail(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<AddressEntity<List<AddressEntity>>>>> getPackersAddress() {
        return apiSource.getPackersAddress().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<List<TalentTypeEntity>> getDefaultTalentSkill(String no, List<TalentTypeEntity<List<TalentTypeEntity>>> typeEntityList) {
        return Observable.create(new ObservableOnSubscribe<List<TalentTypeEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<TalentTypeEntity>> e) throws Exception {
                if (typeEntityList != null) {
                    for (TalentTypeEntity<List<TalentTypeEntity>> entityList : typeEntityList) {
                        if (entityList.getNo().equals(no)) {
                            e.onNext(entityList.getChildren());
                            break;
                        }
                    }
                }
            }
        }).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addTalent(AddTalentEntity entity) {
        return apiSource.addTalent(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> editTalent(AddTalentEntity entity) {
        return apiSource.editTalent(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AddTalentEntity>> getTalentDetail() {
        return apiSource.getTalentDetail().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<TalentTypeEntity<List<TalentTypeEntity>>>>> getTalentType() {
        return apiSource.getTalentType().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<DeviceStateEntity>>>> getPublishDevice(String state, int page, int size,String text) {
        return apiSource.getPublishDevice(state, page, size,text).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addDevice(AddDeviceEntity entity) {
        return apiSource.addDevice(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> updateDevice(AddDeviceEntity entity) {
        return apiSource.updateDevice(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addGoods(AddGoodsEntity entity) {
        return apiSource.addGoods(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> deviceOnlineOrOff(Map map) {
        return apiSource.deviceOnlineOrOff(map).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> delDeviceList(Map map) {
        return apiSource.delDeviceList(map).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<UnitEntity>>> getDeviceUnit() {
        return apiSource.getDeviceUnit().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<PublicTypeEntity<List<PublicTypeEntity>>>>> getDeviceType(String no) {
        return apiSource.getDeviceType(no).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AddDeviceEntity>> getPublishDeviceDetail(String id) {
        return apiSource.getPublishDeviceDetail(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<AddressEntity>>> getDeviceAddress(String parentNo) {
        return apiSource.getDeviceAddress(parentNo).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> checkToken(Map map) {
        return apiSource.checkToken(map).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<PublicTypeEntity<List<PublicTypeEntity>>>>> getMachineOutType() {
        return apiSource.getMachineOutType().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<FilterEntity<List<FilterEntity>>>>> getMachineDict(String firstCategory, String secondCategory) {
        return apiSource.getMachineDict(firstCategory, secondCategory).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<DictEntity>>> getMachinePrice() {
        return apiSource.getMachinePrice().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addMachineIn(AddMachineInEntity entity) {
        return apiSource.addMachineIn(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<MachineStateEntity>>>> getPublishMachineIn(int page, int size, String status) {
        return apiSource.getPublishMachineIn(page, size, status).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> editMachineIn(AddMachineInEntity entity) {
        return apiSource.editMachineIn(entity).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> machineInOnlineOrOff(String id, String status) {
        return apiSource.machineInOnlineOrOff(id, status).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> delMachineInList(String id) {
        return apiSource.delMachineInList(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AddMachineInEntity>> getPublishMachineInDetail(String id) {
        return apiSource.getPublishMachineInDetail(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> changeMobile(Map map) {
        return apiSource.changeMobile(map);
    }

    @Override
    public Observable<BaseEntity> changePwd(Map map) {
        return apiSource.changePwd(map);
    }

    @Override
    public Observable<BaseEntity> commitBankInfo(Map map) {
        return apiSource.commitBankInfo(map);
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<UserAddressEntity>>>> getUserAddressList() {
        return apiSource.getUserAddressList().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> delAddress(String id) {
        return apiSource.delAddress(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<UserAddressEntity>> searchAddress(String id) {
        return apiSource.searchAddress(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> editAddress(UserAddressEntity data) {
        return apiSource.editAddress(data).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addAddress(UserAddressEntity data) {
        return apiSource.addAddress(data).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<GoodsEntity>> getGoodsList(String status) {
        return apiSource.getGoodsList(status).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> downGoods(String id) {
        return apiSource.downGoods(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> upGoods(String id) {
        return apiSource.upGoods(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> deleteGoods(String id) {
        return apiSource.deleteGoods(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<BidInvitationListEntity>>>> getBidInvitationList(int page, int size) {
        return apiSource.getBidInvitationList(page, size).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<BidDetailEntity>> getBidDetail(String id) {
        return apiSource.getBidDetail(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<GoodsListEntity3>>>> getGoodsList(int page, int size, String condition, String status, List<String> cid3,String companyId, String flag) {
        return apiSource.getGoodsList(page, size, condition, status, cid3,companyId,flag).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<List<DictEntity3>>> getGoodsAllDict() {
        return apiSource.getGoodsAllDict().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> upDowngetGoods(String opt, List<String> goodsIds) {
        return apiSource.upDowngetGoods(opt, goodsIds).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> modifyGoodsPrice(String price, String type, List<String> goodsIds) {
        return apiSource.modifyGoodsPrice(price,type,goodsIds).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> modifyGoodsDetailPrice(String id, String price) {
        return apiSource.modifyGoodsDetailPrice(id, price).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<ListResponse<List<SelfPickListEntity3>>>> getCollectList(int page, int size, String status, String type,String groupBuyClass,String goodsName) {
        return apiSource.getCollectList(page, size, status, type,groupBuyClass,goodsName).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> deleteCollectList(String no) {
        return apiSource.deleteCollectList(no).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> deleteCollectList2(String no) {
        return apiSource.deleteCollectList2(no).compose(rxSchedulerHelper());
    }
//    @Override
//    public Observable<BaseEntity<PersonalCenterListEntity>> getPersonalCenterList(String username,String password) {
//        return apiSource.getPersonalCenterList(username,password).compose(rxSchedulerHelper());
//    }

    @Override
    public Observable<BaseEntity<List<FilterEntity<List<FilterEntity>>>>> getPulishDeviceAttr(String firstCategory, String secCategory) {
        return apiSource.getPulishDeviceAttr(firstCategory, secCategory).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> addMachineOut(AddMachineOutEntity entity) {
        return apiSource.addMachineOut(entity).compose(rxSchedulerHelper());
    }

//    @Override
//    public Observable<BaseEntity> editMachineOut(AddMachineOutEntity entity) {
//        return apiSource.editMachineOut(entity).compose(rxSchedulerHelper());
//    }

    @Override
    public Observable<BaseEntity<ListResponse<List<MachineStateEntity>>>> getPublishMachineOut(int page, int size, String status, String text) {
        return apiSource.getPublishMachineOut(page, size, status,text).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AddMachineOutEntity>> getPublishMachineOutDetail(String id, String categoryType) {
        return apiSource.getPublishMachineOutDetail(id, categoryType).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> machineOutOnlineOrOff(String id, String status) {
        return apiSource.machineOutOnlineOrOff(id, status).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity> delMachineOutList(String id) {
        return apiSource.delMachineOutList(id).compose(rxSchedulerHelper());
    }

    @Override
    public Observable<BaseEntity<AuthEntity<List<MachineryCompanyEntity>>>> getAuthInfo() {
        return apiSource.getAuthInfo().compose(rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createTenderData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getTenderData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createCompanyData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getCompanyData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createCustomerData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getCustomerData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createPackerData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getPackerData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createLogisticsData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getLogisticsData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createLogisticsData2() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getLogisticsData2());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createJiCaiData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getJiCaiData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createToDoData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getToDoData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createManageData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getManagerData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    @Override
    public Observable<List<SelfEntity>> createGasManageData() {
        return Observable.create(new ObservableOnSubscribe<List<SelfEntity>>() {
            @Override
            public void subscribe(ObservableEmitter<List<SelfEntity>> e) throws Exception {
                e.onNext(getGasStationData());
            }
        }).compose(this.<List<SelfEntity>>rxSchedulerHelper());
    }

    //商铺经营列表数据
    private List<SelfEntity> getSelfOderData() {
        List<SelfEntity> entityList = new ArrayList<>();
        SelfEntity selfEntity = new SelfEntity();
        selfEntity.setName("采购订单");
        selfEntity.setIcon(R.drawable.icon_my_2);
        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("销售订单");
        selfEntity1.setIcon(R.drawable.icon_my_1);
        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("需求管理");
        selfEntity2.setIcon(R.drawable.icon_my_8);
        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("商品发布");
        selfEntity3.setIcon(R.drawable.icon_my_3);
        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("商品报价");
        selfEntity4.setIcon(R.drawable.icon_my_4);
        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("仓储管理");
        selfEntity5.setIcon(R.drawable.icon_my_5);
        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("品牌管理");
        selfEntity6.setIcon(R.drawable.icon_my_6);
//        SelfEntity selfEntity7 = new SelfEntity();
//        selfEntity7.setName("我的店铺");
//        selfEntity7.setIcon(R.drawable.icon_my_7);
        SelfEntity selfEntity8 = new SelfEntity();
        selfEntity8.setName("我的询价");
        selfEntity8.setIcon(R.drawable.icon_my_6);
        SelfEntity selfEntity9 = new SelfEntity();
        selfEntity9.setName("我的报价");
        entityList.add(selfEntity1);
        entityList.add(selfEntity);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
        entityList.add(selfEntity5);
        entityList.add(selfEntity6);
//        entityList.add(selfEntity7);
//        entityList.add(selfEntity2);
        entityList.add(selfEntity8);
        entityList.add(selfEntity9);
        return entityList;
    }

    //租赁经营列表数据
    private List<SelfEntity> getPublishData(int role) {
        List<SelfEntity> entityList = new ArrayList<>();
        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("机械发布");
        selfEntity1.setIcon(R.drawable.icon_my_9);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("设备发布");
        selfEntity2.setIcon(R.drawable.icon_my_10);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("房产发布");
        selfEntity3.setIcon(R.drawable.self_fangchan);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("我的报价");
        selfEntity4.setIcon(R.drawable.self_mb);

        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("我的求租");
        selfEntity5.setIcon(R.drawable.self_qiuzu);

        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("车辆发布");
        selfEntity6.setIcon(R.drawable.self_car);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity6);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
        entityList.add(selfEntity5);
        return entityList;
    }

    //专业工队列表数据
    private List<SelfEntity> getPickData() {
        List<SelfEntity> entityList = new ArrayList<>();
        SelfEntity selfEntity = new SelfEntity();
        selfEntity.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_my_team));
        selfEntity.setIcon(R.drawable.self_my_team);
        entityList.add(selfEntity);

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team1));
        selfEntity1.setIcon(R.drawable.icon_self_team1);
        entityList.add(selfEntity1);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team5));
        selfEntity2.setIcon(R.drawable.icon_self_team5);
        entityList.add(selfEntity2);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team2));
        selfEntity3.setIcon(R.drawable.icon_self_team2);
        entityList.add(selfEntity3);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team3));
        selfEntity4.setIcon(R.drawable.icon_self_team3);
//        entityList.add(selfEntity4);

        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team4));
        selfEntity5.setIcon(R.drawable.icon_self_team4);
//        entityList.add(selfEntity5);

        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team6));
        selfEntity6.setIcon(R.drawable.icon_self_team6);
        entityList.add(selfEntity6);

        SelfEntity selfEntity7 = new SelfEntity();
        selfEntity7.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team7));
        selfEntity7.setIcon(R.drawable.icon_self_team7);
        entityList.add(selfEntity7);

        SelfEntity selfEntity8 = new SelfEntity();
        selfEntity8.setName(BaseAppHelper.get().getInstance().getResources().getString(R.string.self_team8));
        selfEntity8.setIcon(R.drawable.icon_self_team8);
        entityList.add(selfEntity8);

        return entityList;
    }

    //招采经营列表数据
    private List<SelfEntity> getTenderData() {
        List<SelfEntity> entityList = new ArrayList<>();
        SelfEntity selfEntity = new SelfEntity();
        selfEntity.setName("招标发布");
        selfEntity.setIcon(R.drawable.icon_my_13);

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("规则设定");
        selfEntity1.setIcon(R.drawable.icon_my_14);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("报价查询");
        selfEntity2.setIcon(R.drawable.icon_my_15);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("报价邀请");
        selfEntity3.setIcon(R.drawable.icon_my_16);

        entityList.add(selfEntity);
        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        return entityList;
    }

    //我的管家列表数据
    private List<SelfEntity> getCompanyData() {
        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("网站管理");
        selfEntity1.setIcon(R.drawable.self_website);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("收款账号");
        selfEntity2.setIcon(R.drawable.self_acc);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("发票管理");
        selfEntity3.setIcon(R.drawable.icon_my_26);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("设置");
        selfEntity4.setIcon(R.drawable.icon_my_19);

        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("地址管理");
        selfEntity5.setIcon(R.drawable.self_addr);

        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("认证中心");
        selfEntity6.setIcon(R.drawable.icon_my_21);

//        SelfEntity selfEntity7 = new SelfEntity();
//        selfEntity7.setName("组织架构");
//        selfEntity7.setIcon(R.drawable.icon_my_manage);

//        SelfEntity selfEntity8 = new SelfEntity();
//        selfEntity8.setName("配置");
//        selfEntity8.setIcon(R.drawable.icon_my_23);

        SelfEntity selfEntity9 = new SelfEntity();
        selfEntity9.setName("分享App");
        selfEntity9.setIcon(R.drawable.icon_my_24);

        SelfEntity selfEntity10 = new SelfEntity();
        selfEntity10.setName("官方客服");
        selfEntity10.setIcon(R.drawable.icon_my_25);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
        entityList.add(selfEntity5);
        entityList.add(selfEntity6);
//        entityList.add(selfEntity7);
//        entityList.add(selfEntity8);
        entityList.add(selfEntity9);
        entityList.add(selfEntity10);

        return entityList;
    }

    private List<SelfEntity> getCustomerData() {
        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("客户管理");
        selfEntity1.setIcon(R.mipmap.my_account);

        entityList.add(selfEntity1);
        return entityList;
    }

    private List<SelfEntity> getPackerData() {
        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("我的简历");
        selfEntity1.setIcon(R.drawable.icon_resume);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("我的工队");
        selfEntity2.setIcon(R.drawable.btn_auth);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        return entityList;
    }

    private List<SelfEntity> getLogisticsData(){

        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("货源管理");
        selfEntity1.setIcon(R.drawable.icon_my_27);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("承运商机");
        selfEntity2.setIcon(R.drawable.icon_my_28);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("运输订单");
        selfEntity3.setIcon(R.drawable.icon_my_29);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("我的议价");
        selfEntity4.setIcon(R.drawable.icon_my_29);


        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("司机版下载");
        selfEntity5.setIcon(R.drawable.icon_my_30);
        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("轨迹管理");
        selfEntity6.setIcon(R.drawable.icon_my_30);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
      //  entityList.add(selfEntity6);
        return entityList;
    }
    private List<SelfEntity> getGasStationData(){
        List<SelfEntity> entityList = new ArrayList<>();
        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("基础信息");
        selfEntity1.setIcon(R.drawable.jichuxinxi);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("油品管理");
        selfEntity2.setIcon(R.drawable.youpin);
        entityList.add(selfEntity1);
        entityList.add(selfEntity2);

        return entityList;
    }

    private List<SelfEntity> getLogisticsData2(){

        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("运输订单");
        selfEntity1.setIcon(R.drawable.icon_my_31);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("报价订单");
        selfEntity2.setIcon(R.drawable.icon_my_32);

        SelfEntity selfEntity3 = new SelfEntity();
//        selfEntity3.setName("商机订阅");
        selfEntity3.setName("货源订阅");
        selfEntity3.setIcon(R.drawable.icon_my_33);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("承运管理");
        selfEntity4.setIcon(R.drawable.icon_my_34);

        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("常跑路线");
        selfEntity5.setIcon(R.drawable.icon_my_35);

        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("货主议价");
        selfEntity6.setIcon(R.drawable.icon_my_36);

        SelfEntity selfEntity7 = new SelfEntity();
        selfEntity7.setName("司机认证");
        selfEntity7.setIcon(R.drawable.icon_my_36);

        SelfEntity selfEntity8 = new SelfEntity();
        selfEntity8.setName("司机版下载");
        selfEntity8.setIcon(R.drawable.icon_my_37);

        SelfEntity selfEntity9 = new SelfEntity();
        selfEntity9.setName("车辆管理");
        selfEntity9.setIcon(R.drawable.icon_my_37);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
        entityList.add(selfEntity5);
        entityList.add(selfEntity6);
        entityList.add(selfEntity9);
 //       entityList.add(selfEntity7);
//        entityList.add(selfEntity8);
        return entityList;
    }

    private List<SelfEntity> getJiCaiData(){

        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("我的集采");
        selfEntity1.setIcon(R.drawable.ic_ji_cai_publick);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("我的加盟");
        selfEntity2.setIcon(R.drawable.ic_ji_cai_my);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("我的报价");
        selfEntity3.setIcon(R.drawable.ic_ji_cai_price);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("报价机遇");
        selfEntity4.setIcon(R.drawable.baojiajiyu);

        SelfEntity selfEntity5 = new SelfEntity();
        selfEntity5.setName("加盟机遇");
        selfEntity5.setIcon(R.drawable.jiameng);

        SelfEntity selfEntity6 = new SelfEntity();
        selfEntity6.setName("供方发起");
        selfEntity6.setIcon(R.drawable.changjiajicai);

        SelfEntity selfEntity7 = new SelfEntity();
        selfEntity7.setName("我的监督");
        selfEntity7.setIcon(R.drawable.jicaijd);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        entityList.add(selfEntity6);
        entityList.add(selfEntity4);
        entityList.add(selfEntity5);
        entityList.add(selfEntity7);
        return entityList;
    }

    private List<SelfEntity> getToDoData(){

        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("待接单");
        selfEntity1.setIcon(R.drawable.ic_my_djd);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("待确认");
        selfEntity2.setIcon(R.drawable.ic_my_dqr);

        SelfEntity selfEntity3 = new SelfEntity();
        selfEntity3.setName("待收货");
        selfEntity3.setIcon(R.drawable.ic_my_dsh);

        SelfEntity selfEntity4 = new SelfEntity();
        selfEntity4.setName("待发货");
        selfEntity4.setIcon(R.drawable.ic_my_dfh);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        entityList.add(selfEntity3);
        entityList.add(selfEntity4);
        return entityList;
    }

    private List<SelfEntity> getManagerData(){

        List<SelfEntity> entityList = new ArrayList<>();

        SelfEntity selfEntity1 = new SelfEntity();
        selfEntity1.setName("待审核员工");
        selfEntity1.setIcon(R.drawable.ic_my_shenhe);

        SelfEntity selfEntity2 = new SelfEntity();
        selfEntity2.setName("邀请员工");
        selfEntity2.setIcon(R.drawable.ic_my_yaoqing);

        entityList.add(selfEntity1);
        entityList.add(selfEntity2);
        return entityList;
    }
}
